package main

import (
	"fmt"
	"time"
)

// type MyColor string

// const (
// 	BLACK MyColor = "black"
// )

// type Month int

// const (
// 	January   Month = 1 + iota // 1
// 	February                   // 2
// 	March                      //	3
// 	April                      // 4
// 	May                        // 5
// 	June                       // 6
// 	July                       // 7
// 	August                     // 8
// 	September                  // 9
// 	October                    // 10
// 	November                   // 11
// 	December                   // 12
// )

// func test(month Month) {
// 	fmt.Println(month)
// }

func main() {
	t1 := time.Now() // tz local
	fmt.Println(
		t1.Year(), t1.Month(), t1.Day(), int(t1.Month()),
		t1.Hour(), t1.Minute(), t1.Second(), t1.Nanosecond(),
		t1.Location(), t1.Weekday(), t1.YearDay(),
	)
	fmt.Println(t1.Date())                                                // 3返回值
	fmt.Println(t1.Unix(), t1.UnixMilli(), t1.UnixMicro(), t1.UnixNano()) // 时间戳
	tz, _ := time.LoadLocation("UTC")                                     // 时区
	t4 := time.Date(2008, 7, 12, 10, 5, 6, 0, tz)                         // 2008-07-12 10:05:06 +0000 UTC
	fmt.Println(t4)
	fmt.Println(t4.Local())

	t5 := time.Unix(1754012825, 0)
	fmt.Println(t5, "###") // 2025-04-01 10:07:05 +0800 CST

	s1 := "2008/10/7 10:05:06.2999258"
	t7, err := time.ParseInLocation("2006/1/2 15:04:05", s1, tz)
	if err != nil {
		fmt.Println("Error parsing time:", err)
		return
	}
	fmt.Println(t7) // 2008-10-07 10:05:06 +0000 UTC
	fmt.Println(t7.Local())
}
